package com.frejoys.dao.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.frejoys.dao.entity.Category;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@InterceptorIgnore(dataPermission = "true")
public interface CategoryMapper extends BaseMapper<Category> {

    @Select("select path,sort from j_category where id = #{id}")
    Category getPathById(@Param("id") Integer id);


    @Update("update j_category set sort = #{sort} where id = #{id}")
    int updateSort(@Param("id")Integer id,@Param("sort")Integer sort);


    @Select("select id,path from j_category where id = #{pid}")
    Category getPidPath(Integer pid);
}
